package com.atguigu.yygh.oss.controller;

import com.atguigu.yygh.common.result.Result;
import com.atguigu.yygh.oss.service.FileService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @FileName: FileApiController
 * @Author Steven
 * @Date: 2021/8/10
 */
@Api(tags = "对象存储")
@RequestMapping("/api/oss/file")
@RestController
public class FileApiController {

    @Autowired
    FileService fileService;

    @PostMapping("fileUpload")
    public Result upload(MultipartFile file){
        String url = fileService.upload(file);
        return Result.ok(url);
    }
}
